package com.wing.common.enums;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * @version 1.1.0
 * @Author hz
 * @Date 2024-08-21 14:15
 **/
public interface InspectEnum {

    @Getter
    enum InspectTypeEmum{
        XTSC(1,"系统生成"),
        RWCJ(2,"任务创建");
        private Integer code;

        private String name;


        public void setCode(Integer code) {
            this.code = code;
        }


        public void setName(String name) {
            this.name = name;
        }

        InspectTypeEmum(Integer code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(Integer code) {
            InspectTypeEmum[] homeServiceStatuses = values();
            for (InspectTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static Integer getCodeByName(String name) {
            InspectTypeEmum[] homeServiceStatuses = values();
            for (InspectTypeEmum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    @Getter
    enum InspectStatusEnum{
        DRL(1,"新建"),
        YRL(2,"已认领"),
        WC(3,"完成");

        private Integer code;

        private String name;


        public void setCode(Integer code) {
            this.code = code;
        }

        public void setName(String name) {
            this.name = name;
        }

        InspectStatusEnum(Integer code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(Integer code) {
            InspectStatusEnum[] homeServiceStatuses = values();
            for (InspectStatusEnum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static Integer getCodeByName(String name) {
            InspectStatusEnum[] homeServiceStatuses = values();
            for (InspectStatusEnum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }

    @Getter
    enum examineTypeEnum{
        DSH(0,"待审核"),
        SHTG(1,"审核通过"),
        WTG(2,"未通过");

        private Integer code;

        private String name;


        public void setCode(Integer code) {
            this.code = code;
        }


        public void setName(String name) {
            this.name = name;
        }

        examineTypeEnum(Integer code, String name){
            this.code = code;
            this.name = name;
        };

        /**
         * 根据服务code获取服务名称
         * @param code
         * @return
         */
        public static String getNameByCode(Integer code) {
            examineTypeEnum[] homeServiceStatuses = values();
            for (examineTypeEnum homeService : homeServiceStatuses) {
                if (homeService.getCode().equals(code)) {
                    return homeService.getName();
                }
            }
            return null;
        }

        /**
         * 根据服务名称获取服务code
         * @param name
         * @return
         */
        public static Integer getCodeByName(String name) {
            examineTypeEnum[] homeServiceStatuses = values();
            for (examineTypeEnum homeService : homeServiceStatuses) {
                if (homeService.getName().equals(name)) {
                    return homeService.getCode();
                }
            }
            return null;
        }
    }
}
